<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
  <meta name="description" content="API docs for the createHmacFor function from the dart_otp library, for the Dart programming language.">
  <title>createHmacFor function - dart_otp library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="..">

  <link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" href="static-assets/github.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">
  
</head>

<body>

<div id="overlay-under-drawer"></div>

<header id="title">
  <button id="sidenav-left-toggle" type="button">&nbsp;</button>
  <ol class="breadcrumbs gt-separated dark hidden-xs">
    <li><a href="index.html">dart_otp</a></li>
    <li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
    <li class="self-crumb">createHmacFor function</li>
  </ol>
  <div class="self-name">createHmacFor</div>
  <form class="search navbar-right" role="search">
    <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
  </form>
</header>

<main>

  <div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <header id="header-search-sidebar" class="hidden-l">
      <form class="search-sidebar" role="search">
        <input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
      </form>
    </header>
    
    <ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
      <li><a href="index.html">dart_otp</a></li>
      <li><a href="dart_otp/dart_otp-library.html">dart_otp</a></li>
      <li class="self-crumb">createHmacFor function</li>
    </ol>
    
    <h5>dart_otp library</h5>
    <ol>
      <li class="section-title"><a href="dart_otp/dart_otp-library.html#classes">Classes</a></li>
      <li><a href="dart_otp/HOTP-class.html">HOTP</a></li>
      <li><a href="dart_otp/TOTP-class.html">TOTP</a></li>
    
    
    
    
      <li class="section-title"><a href="dart_otp/dart_otp-library.html#functions">Functions</a></li>
      <li><a href="dart_otp/createHmacFor.html">createHmacFor</a></li>
      <li><a href="dart_otp/otpTypeValue.html">otpTypeValue</a></li>
      <li><a href="dart_otp/rawValue.html">rawValue</a></li>
    
      <li class="section-title"><a href="dart_otp/dart_otp-library.html#enums">Enums</a></li>
      <li><a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></li>
      <li><a href="dart_otp/OTPType-class.html">OTPType</a></li>
    
    
    </ol>
  </div><!--/.sidebar-offcanvas-left-->

  <div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
      <div><h1><span class="kind-function">createHmacFor</span> function </h1></div>

    <section class="multi-line-signature">
        <span class="returntype">Hmac</span>
                <span class="name ">createHmacFor</span>
(<wbr>{<span class="parameter" id="createHmacFor-param-algorithm"><span class="type-annotation"><a href="dart_otp/OTPAlgorithm-class.html">OTPAlgorithm</a></span> <span class="parameter-name">algorithm</span>, </span> <span class="parameter" id="createHmacFor-param-key"><span class="type-annotation">List<span class="signature">&lt;<wbr><span class="type-parameter">int</span>&gt;</span></span> <span class="parameter-name">key</span></span> })
    </section>
    
    <section class="summary source-code" id="source">
      <h2><span>Implementation</span></h2>
      <pre class="language-dart"><code class="language-dart">Hmac createHmacFor({OTPAlgorithm algorithm, List&lt;int&gt; key}) {
  if (key == null) {
    return null;
  }

  switch (algorithm) {
    case OTPAlgorithm.SHA1:
      return Hmac(sha1, key);
    case OTPAlgorithm.SHA256:
      return Hmac(sha256, key);
    case OTPAlgorithm.SHA384:
      return Hmac(sha384, key);
    case OTPAlgorithm.SHA512:
      return Hmac(sha512, key);

    default:
      return null;
  }
}</code></pre>
    </section>

  </div> <!-- /.main-content -->

  <div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
  </div><!--/.sidebar-offcanvas-->

</main>

<footer>
  <span class="no-break">
    dart_otp 1.3.0
  </span>

  
</footer>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/highlight.pack.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>


</body>

</html>
